home *** CD-ROM | disk | FTP | other *** search
- unit ExTrace;
-
- interface
-
- uses
- YAST;
-
- function ExampleReportStackFrame(var StackInfo: TStackInfo; PrivateData: Pointer): boolean;
-
- implementation
-
- {$IFDEF WINDOWS}
- uses
- WinCrt;
- {$ENDIF}
-
- type
- str2 = string[2];
- str4 = string[4];
- WordRec = record
- Lo, Hi : byte;
- end;
-
- function HexB(Byt: byte): Str2;
- const
- HexChars : array[0..15] of char = '0123456789ABCDEF';
- begin
- HexB := HexChars[Byt shr 4] + HexChars[Byt and $0F];
- end;
-
-
- function HexW(Wrd: Word): Str4;
- begin
- HexW := HexB(WordRec(Wrd).Hi) + HexB(WordRec(Wrd).Lo);
- end;
-
-
- function ExampleReportStackFrame(var StackInfo: TStackInfo; PrivateData: Pointer): boolean;
- const
- Dists : array[boolean] of char = ('N', 'F');
- type
- PBoolean = ^Boolean;
- var
- i : integer;
- FirstFlag : PBoolean absolute PrivateData;
- begin
- if FirstFlag^ then
- begin
- FirstFlag^ := false;
- Writeln('Starting stack trace:');
- Writeln('CS=', HexW(CSeg));
- Writeln('DS=', HexW(DSeg));
- Writeln('SS=', HexW(SSeg));
- end;
-
- with StackInfo do
- begin
- Write(Dists[IsFar], ' ', HexW(ReturnLog), ':', HexW(ReturnOfs), ' = ');
- for i := 0 to ParamSize-1 do
- Write(HexW(ParamPtr^[i]), ',');
- Writeln;
- end;
- ExampleReportStackFrame := true;
- end;
-
- end.
-